package lab02.text06;

import java.util.Scanner;

/**
 * Created by Adminitrator on 2017/10/15.
 */
public class Triangle {
    //三个边，以及周长、面积
    double a;
    double b;
    double c;
    double periment;
    double area;
    boolean bTriangle;
    double s;

    void getPeriment(){
        System.out.println("周长");
        System.out.println(a+b+c);
    }
    void getArea() {
        System.out.println("面积");
        System.out.println(Math.sqrt(s * (s - a) * (s - b) * (s - c)));
    }

    boolean isbTriangle(){
        if (a+b>c&&a+c>b&&b+c>a)
            bTriangle=true;
        System.out.println("能形成三角形吗");
        return bTriangle;
       }

    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        System.out.println("输入三条边");
        double a=in.nextDouble();
        double b=in.nextDouble();
        double c=in.nextDouble();
        double s=(a+b+c)/2;
       Triangle tri=null;
        tri=new Triangle();
        tri.a=a;
        tri.b=b;
        tri.c=c;
        tri.s=s;
        tri.isbTriangle();
        tri.getArea();
        tri.getPeriment();
    }

        }


